package com.qrback.repository;

import com.qrback.entity.OperationLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface OperationLogRepository extends JpaRepository<OperationLog, Integer> {
    
    // 根据用户ID查询操作日志
    List<OperationLog> findByUserId(Integer userId);
    Page<OperationLog> findByUserId(Integer userId, Pageable pageable);
    
    // 根据设备ID查询操作日志
    List<OperationLog> findByDeviceId(Integer deviceId);
    Page<OperationLog> findByDeviceId(Integer deviceId, Pageable pageable);
    
    // 根据操作类型查询操作日志
    List<OperationLog> findByOperation(String operation);
    Page<OperationLog> findByOperation(String operation, Pageable pageable);
    
    // 根据用户ID和设备ID查询操作日志
    Page<OperationLog> findByUserIdAndDeviceId(Integer userId, Integer deviceId, Pageable pageable);
    
    // 根据用户ID和操作类型查询操作日志
    Page<OperationLog> findByUserIdAndOperation(Integer userId, String operation, Pageable pageable);
    
    // 根据设备ID和操作类型查询操作日志
    Page<OperationLog> findByDeviceIdAndOperation(Integer deviceId, String operation, Pageable pageable);
    
    // 根据用户ID、设备ID和操作类型查询操作日志
    Page<OperationLog> findByUserIdAndDeviceIdAndOperation(Integer userId, Integer deviceId, String operation, Pageable pageable);
}